import qs from 'qs'

export default $axios => ({
    getItemList(){
        return $axios.get('/server/item',{
            params:{
                type:'all',
                id:''
            }
        })
    },
    updateItem(itemId,productId,listPrice,unitCost,supplierId,status,attribute1,attribute2,attribute3,attribute4,attribute5,quantity){
        return $axios.put('/server/item',qs.stringify({
            itemId,
            productId,
            listPrice,
            unitCost,
            supplierId,
            status,
            attribute1,
            attribute2,
            attribute3,
            attribute4,
            attribute5,
            quantity
        }))
    },
    deleteItem(itemId){
        return $axios.delete('/server/item',{
            params:{
                type:'itemId',
                id: itemId,
            }
        })
    },
    addItem(itemId,productId,listPrice,unitCost,quantity,status,attribute1,attribute2,attribute3,attribute4,attribute5){
    return $axios.post('/server/item',qs.stringify({
        itemId,
        productId,
        listPrice,
        unitCost,
        quantity,
        status,
        attribute1,
        attribute2,
        attribute3,
        attribute4,
        attribute5,
        supplierId:'1',
    }))
    }
})
